<?php
    require_once('../../code/global.php');
    require_once('/code/Artist.php');
    require_once('/code/Product.php');
    require_once('/code/SiteInfo.php');
    $artist=new Artist();
    if(isset($_GET['aid'])) $aid=intval($_GET['aid']);
    else $aid=$artist->getFirstArtistId();
    $siteInfo=new SiteInfo();
    $s=$siteInfo->getSiteInfo();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="description" content="<?php echo $s['meta_keyword'] ?>" />  
        <meta name="keyword" content="<?php echo $s['meta_description'] ?>" />
        <title>Gallery | <?php echo $s['site_name'] ?></title>
        <link rel="shortcut icon" href="/styles/images/icon.ico" type="image/x-icon" />
        <link rel="stylesheet" href="/styles/styles.css" />
        <link rel="stylesheet" href="/styles/jquery.lightbox-0.5.css" />
        <script type="text/javascript" src="/script/jquery-1.6.1.min.js"></script>
        <script type="text/javascript" src="/script/jquery.lightbox-0.5.min.js"></script>
        <script type="text/javascript" src="/script/setLightbox.js"></script>
        <script type="text/javascript" src="/script/jsScroller.js"></script>
        <script type="text/javascript" src="/script/jsScrollbar.js"></script>
        <script type="text/javascript" src="/script/jsScrollerTween.js"></script>
        <script type="text/javascript" src="/script/setScroller.js"></script>
    </head>
    <body>
        <div id="container">
            <div id="stripe"></div>
            <a href="/" title="<?php echo $s['site_name'] ?>"><div id="header">
            </div></a>
            <div id="menu">
                <ul><li class="current">Gallery</li><li class="seperator">|</li><li><a href="/news">News</a></li><li class="seperator">|</li><li><a href="/about">About us</a></li><li class="seperator">|</li><li><a href="/contact">Contact us</a></li></ul>
            </div>
            <div id="stripe"></div>
            <div id="content">
                <div id="leftmenu">
                    <div class="Scroller">
                    <div class="Scroller-Container">
                    <ul>
                        <?php
                            $a=$artist->getArtists(1);
                            $a_count=count($a);
                            $i=0;
                            while($i<$a_count){
                                if($aid==$a[$i]['artist_id']){
                                    echo '<li id="selected"><a>'.$a[$i]['name'].'</a><span class="countSpan"> ('.$a[$i]['item_count'].')</span></li>'."\n\r";}
                                else{
                                    echo '<li><a href="/gallery/by-photographer?aid='.$a[$i]['artist_id'].'">'.$a[$i]['name'].'</a><span class="countSpan"> ('.$a[$i]['item_count'].')</span></li>'."\n\r";}
                                ++$i;
                            }
                        ?>
                    </ul>
                    </div>
                    <div id="Scrollbar-Container">
                        <div class="Scrollbar-Up"></div>
                        <div class="Scrollbar-Down"></div>
                        <div class="Scrollbar-Track">
                            <div class="Scrollbar-Handle"></div>
                        </div>
                    </div>
                    </div>
                    <ul><li><a href="/gallery">By Category...</a></li></ul>
                </div>
                <div id="gallrightpanel">
                    <?php
                        $product=new Product();
                        $p=$product->getProductsByArtist($aid);
                        $p_count=count($p);
                        $i=0;
                        $info='';
                        if(0==$aid) echo '<div class="noPhotoDiv">There\'s no photographer listed yet.</div>';
                        else if(0==$p_count) echo '<div class="noPhotoDiv">There\'s no photo by this photographer.</div>';
                        while($i<$p_count){
                            $info='<span class=\'title\'>Subject: </span>'.$p[$i]['subject'].'<br /><span class=\'title\'>Photographer: </span>'.$p[$i]['name'].'<br /><span class=\'title\'>Date: </span>'.$p[$i]['date'].'&nbsp;&nbsp;&nbsp;<span class=\'title\'>Area: </span>'.$p[$i]['area'].'<br /><span class=\'title\'>Type: </span>'.$p[$i]['type'].'<br /><span class=\'title\'>Size: </span>'.$p[$i]['size'].'<br /><span class=\'title\'>Condition: </span>'.$p[$i]['condition'].'<br /><span class=\'title\'>Price: </span>'.($p[$i]['is_sold']?'SOLD':'￡'.$p[$i]['price']).'<br />';
                            echo '<div class="galleryThumbDiv"><a href="'.$p[$i]['img_url'].'" target="_blank" info="'.$info.'"><img src="'.$p[$i]['thumb_url'].'" alt="'.$p[$i]['subject'].'"/></a></div>'."\n\r";
                            ++$i;
                        }
                    ?>
                </div>
            </div>
            <div id="stripe"></div>
            <div id="footer">
                &copy; <?php echo $s['site_name'] ?> All rights reserved.
                <ul><li><a href="/about/terms-conditions">Terms & Conditions</a></li><li>|</li><li><a href="/about">About us</a></li><li>|</li><li><a href="/contact">Contact us</a></li><ul> 
            </div>
            <div id="stripe"></div>  
        </div>
    </body>
</html>
